package interview.topk;

import java.util.Comparator;
import java.util.Stack;

public class StackComparator implements Comparator<Stack<Integer>> {

	@Override
	public int compare(Stack<Integer> s1, Stack<Integer> s2) {
		if(s1.empty())
			return -1;
		
		if(s2.empty())
			return 1;
		
		if(s1.peek() > s2.peek()) {
			return 1;
		} else if (s1.peek() < s2.peek()) {
			return -1;
		} else {
			return 0;
		}
	}

}
